package io.renren.modules.erp.service;

import com.baomidou.mybatisplus.extension.service.IService;
import io.renren.common.utils.PageUtils;
import io.renren.modules.erp.entity.AccountHead;
import io.renren.modules.erp.entity.DepotItem;
import io.renren.modules.erp.entity.DepotItemVo4DetailByTypeAndMId;
import io.renren.modules.erp.entity.DepotItemVo4WithInfoEx;
import io.renren.modules.erp.vo.DepotItemStockWarningCount;
import io.swagger.models.auth.In;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface DepotItemService extends IService<DepotItem> {

    DepotItem getDepotItem(long id)throws Exception ;
    List<DepotItem> getDepotItem()throws Exception ;

    PageUtils select(String name, Integer type, String remark, int currPage, int pageSize)throws Exception;
    Long countDepotItem(String name, Integer type, String remark) throws Exception;

    int insertDepotItem(String beanJson, HttpServletRequest request)throws Exception;

    int updateDepotItem(String beanJson, Long id, HttpServletRequest request)throws Exception ;

    int deleteDepotItem(Long id, HttpServletRequest request)throws Exception ;

    int batchDeleteDepotItem(String ids, HttpServletRequest request)throws Exception ;

    int checkIsNameExist(Long id, String name)throws Exception ;

    PageUtils findDetailByTypeAndMaterialIdList(Map<String, String> map, Integer currPage, Integer pageSize)throws Exception ;

    Long findDetailByTypeAndMaterialIdCounts(Map<String, String> map)throws Exception ;

    int insertDepotItemWithObj(DepotItem depotItem)throws Exception;

    int updateDepotItemWithObj(DepotItem depotItem)throws Exception ;

    List<DepotItem> getListByHeaderId(Long headerId)throws Exception ;

    List<DepotItemVo4WithInfoEx> getDetailList(Long headerId)throws Exception ;

    List<DepotItemVo4WithInfoEx> findByAll2(String name, String model, String endTime, Integer currPage, Integer pageSize,String depotId)throws Exception ;

    List<DepotItemVo4WithInfoEx> findByAll(String name, String model, String endTime, Integer currPage, Integer pageSize)throws Exception ;

    int findByAllCount(String name, String model, String endTime)throws Exception ;

    BigDecimal buyOrSale(String type, String subType, Long MId, String MonthTime, String sumType) throws Exception;

    BigDecimal inOrOutPrice(String type, String subType, String MonthTime) throws Exception;
    void saveDetials(String rows, Long headerId, Long tenantId, HttpServletRequest request,Long userId) throws Exception;
    String findUnitName(Long mId) throws Exception;

    void deleteDepotItemHeadId(Long headerId)throws Exception ;
    int batchDeleteDepotItemByIds(String ids,Long userId)throws Exception ;

    List<DepotItemStockWarningCount> findStockWarningCount(int offset, Integer rows, Integer pid) ;
    int findStockWarningCountTotal(Integer pid) ;

    BigDecimal getStockByParam(Long depotId, Long mId, String beginTime, String endTime, Long tenantId);
    BigDecimal getInNumByParam(Long depotId, Long mId, String beginTime, String endTime, Long tenantId);
    BigDecimal getOutNumByParam(Long depotId, Long mId, String beginTime, String endTime, Long tenantId);
    void updateCurrentStock(DepotItem depotItem, Long tenantId);

    BigDecimal getLockAmount(Long depotId, Long materialId, Long tenantId);
}
